package 
{
    
    
    import core.manager.*;
    import core.manager.modelManager.*;
    import core.manager.playerManager.*;
    import core.manager.playerManager.musicPlayerManager.*;
    import core.manager.playerManager.swfManager.*;
    import core.manager.pluginManager.*;
    import core.manager.popupManager.*;
    import core.manager.sceneManager.*;
    
    import flash.events.*;
    import flash.system.*;
    
    import mx.core.*;
    
    import plugins.lsd.SlidingPuzzle.SlidingPuzzleGame;
    import plugins.lxfa.animatePlayer.AnimatePlayer;
    import plugins.lxfa.flvModule.*;
    import plugins.lxfa.index.view.*;
    import plugins.yzhkof.pv3d.control.*;
    
    import view.HideContextMenu;
    import view.ToolTip;
    import view.loadings.*;

    public class ExpoProject
    {
        private var loadingMC:LoadingWaveRota;

        public function ExpoProject()
        {
            init();
            return;
        }// end function

        private function init() : void
        {
            Security.allowDomain("http://pavilion.expo.cn/p5006/ssize/htm/xml/crossdomain.xml");
            Security.loadPolicyFile("http://pavilion.expo.cn/p5006/ssize/htm/xml/crossdomain.xml");
            initModelManager();
        }// end function

        private function initApi() : void
        {
            new FlvBase();
            new Pv3dSceneCtr();
            return;
        }// end function

        private function on_model_loaded(_focusColor:Event) : void
        {
            MainSystem.getInstance();
            PluginManager.getInstance().init(Application.application);
            PlayerManager.getInstance().init();
            SceneManager.getInstance();
            CustomMusicManager.getInstance();
            CustomPopupManager.getInstance();
            ToolTip.init(Application.application.stage);
            AnimatePlayer.getInstance();
            new HideContextMenu();
            var game:SlidingPuzzleGame;
            dispose();
            initApi();
            SwfManager.getInstance().showSwfById("qq");
            return;
        }// end function

        private function initModelManager() : void
        {
//            var _loc_1:Module;
            ModelManager.getInstance();
            loadingMC = new LoadingWaveRota();
            loadingMC.x = Application.application.width / 2;
            loadingMC.y = Application.application.height / 2;
            Application.application.addChild(loadingMC);
            ModelManager.getInstance().addEventListener(Event.COMPLETE, on_model_loaded);
            ModelManager.getInstance().addEventListener(ProgressEvent.PROGRESS, on_progress);
            return;
        }// end function

        private function on_progress(_focusColor:ProgressEvent) : void
        {
            loadingMC.updateByProgressEvent(_focusColor);
            return;
        }// end function

        private function dispose() : void
        {
            ModelManager.getInstance().removeEventListener(ProgressEvent.PROGRESS, on_progress);
            ModelManager.getInstance().removeEventListener(Event.COMPLETE, on_model_loaded);
            if (loadingMC != null)
            {
                if (loadingMC.parent != null)
                {
                    loadingMC.parent.removeChild(loadingMC);
                }
                loadingMC = null;
            }
            return;
        }// end function

    }
}
